<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>产品生成工序设计</title>
    <style>
        #ss label{
            margin-left: 15px;;
        }
    </style>
</head>
<!-- 新 Bootstrap4 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">


<link rel="stylesheet" href="../../css/bootstrap-table.min.css">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>

<!-- bootstrap.bundle.min.js 用于弹窗、提示、下拉菜单，包含了 popper.min.js -->
<script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>

<!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
<script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>



<script src="../../js/bootstrap-table.min.js"></script>

<script src="../../js/bootstrap-table-zh-CN.min.js"></script>
<body>
<div id="ss" style="margin-top: 15px;">
    <p class="form-inline" style="margin-left: 60px;">
        <label for="register_time_start">请输入建档时间：</label>
        <input id="register_time_start" type="datetime-local" class="form-control">至
        <input id="register_time_end" type="datetime-local" class="form-control">
        <label for="product_name">请输入产品名称：</label>
        <input id="product_name" class="form-control">
        <button id="query_file_ok" class="btn btn-primary" style="margin-left: 30px;">搜索</button>
    </p>
</div>
<div>
    <table id="tabb">

    </table>
</div>

<!-- 模态框（根据产品编号查询到全部信息） -->
<div class="modal fade" id="showall">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">

            <!-- 模态框头部 -->
            <div class="modal-header">
                <h6 class="modal-title">您正在做的业务是：生产管理--产品生产工序设计--制定产品生产工序设计单</h6>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>

            <!-- 模态框主体 -->
            <div class="modal-body ">

                <div>
                    <button class="btn btn-primary" id="all">全部信息</button>
                    <button class="btn btn-info" id="zyxx">主要信息</button>
                    <button class="btn btn-success" id="fzxx">辅助信息</button>
                </div>

                <div style="display: flex; flex-direction: column">
                    <!--主要信息-->
                    <div style="margin-top: 5px;" id="zy">
                        <div class="bg-info text-white" style="padding-left: 20px; height:25px;">主信息</div>
<!--                        <span id="q_productId" style="background-color: rgba(195, 195, 195, 0.61);float:left;width:80%;border-bottom: 1px solid white">s</span>-->
                        <div style="height: 20px;"><span style=" background-color:deepskyblue;float: left;width: 20%;">档案编号</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 20%);border-bottom: 1px solid white;height: 25px;" id="q_productId"></div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">产品名称</span><input type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_productName"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">制造商</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_factoryName"></div>
                        </div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">一级分类</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_firstKindName"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">二级分类</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_secondKindName"></div>
                        </div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">三级分类</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_thirdKindName"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">产品简称</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_productNick"></div>
                        </div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">用途类型</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_type"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">档次级别</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_productClass"></div>
                        </div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">计量单位</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_personalUnit"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">计量值</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_personalValue"></div>
                        </div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">市场单价(元)</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_listPrice"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">计划成本单价</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_costPrice"></div>
                        </div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">成本单价</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_realCostPrice"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">&nbsp;</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="x"></div>
                        </div>

                    </div>

                    <!--辅助信息-->
                    <div style="margin-top: 5px;" id="fz">
                        <div class="bg-info text-white" style="padding-left: 20px; height:25px;">辅助信息</div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">保修期</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_warranty"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">替代品名称</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_twinName"></div>
                        </div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">替代品编号</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_twinId"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">生命周期</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_lifecycle"></div>
                        </div>
                        <div >
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">单位</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_amountUnit"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">&nbsp;</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_amountUnit"></div>
                        </div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">供应商集合</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_providerGroup"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">产品描述</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_productDescribe"></div>
                        </div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">档案附件</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_danganfujian1"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">档案变更累计</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_fileChangeAmount"></div>
                        </div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">最近变更时间</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_changeTime"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">建档时间</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_registerTime"></div>
                        </div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">产品经理</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_responsiblePerson"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">登记人</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_register"></div>
                        </div>
                        <div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">复核人</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_checker"></div>
                            <div style="width: 50%; float: left;"><span style="background-color:deepskyblue;width: 40%;float: left;">复核时间</span><input readonly=“readonly” type="text" style="border:none;outline: none;background-color: rgba(195, 195, 195, 0.61);float:left;width:calc(100% - 40%);border-bottom: 1px solid white;height: 25px;" id="q_checkTime"></div>
                        </div>

                    </div>

                </div>

            </div>

            <!-- 模态框底部 -->
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">返回</button>
            </div>

        </div>
    </div>
</div>

<!--制定工序设计单-->
<div class="modal fade" id="showsheet">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">

            <!-- 模态框头部 -->
            <div class="modal-header">
                <h6 class="modal-title">您正在做的业务是：生产管理--产品生产工序设计--制定产品生产工序设计单</h6>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>

            <!-- 模态框主体 -->
            <div class="modal-body" style="background-color: darkgray;">
                <div style="display: flex;justify-content: flex-end">
                    <button type="button" class="btn btn-primary" style="margin-right: 5px;" data-toggle="modal" data-target="#addprocessshow">添加工序</button>
                    <button type="button" class="btn btn-primary"style="margin-right: 5px;" id="deletegx">删除工序</button>
                    <button type="button" class="btn btn-info"style="margin-right: 5px;" id="tijiao">提交</button>
                    <button type="button" class="btn btn-secondary"style="margin-right: 5px;" data-dismiss="modal">返回</button>
                </div>

                <div style="border: 1px solid black;margin-top: 10px; background-color: white;display: flex;flex-direction: column">
                    <h5 style="text-align: center;margin-top: 20px">生产工序设计单</h5>
                    <div style="display: flex;">
                        <div  style="margin-left: 10%;width: 40%;" >产品名称：<span id="she_product_name"></span></div>
                        <div style="width: 40%;">产品编号：<span id="she_productId"></span></div>
                    </div>
                    <div  style="display: flex;">
                        <div style="margin-left:10%;margin-top: 10px;">设计人 ：</div><input id="she_designer"  style="outline: none;border: none;border-bottom: 1px solid black;width: 30%"></div>
                    <div style="display: flex;">
                        <table class="table-sm  table-hover table-bordered" id="shengcahngtab" style="margin-left: 10%;margin-top: 20px;text-align: center"  cellpadding="0" cellspacing="0" width="80%;">
                            <tr class="table-primary" style="color: white">
                                <td>点选</td>
                                <td>工序名称</td>
                                <td>工序编号</td>
                                <td>描述</td>
                                <td>工时数</td>
                                <td>工时单位</td>
                                <td>工时成本</td>
                                <td>工时成本小计（元）</td>
                            </tr>
                        </table>
                    </div>
                    <div  style="display: flex;">
                        <div style="margin-left: 10%;margin-top: 20px;">
                            登记人 ：</div><input id="she_checker"  style="outline: none;border: none;border-bottom: 1px solid black;width: 30%;">
                        <div style="margin-left: 45px;margin-top: 20px;">登记时间：<span id="she_checkTime"></span></div>
                    </div>
                    <div style="display: flex;">
                        <div style="margin-left:10%;margin-top: 10px;display: flex;width: 100%;margin-bottom: 20px;">
                            设计要求：
                            <textarea id="she_procedureDescribe" rows="3" style="width: 77%;margin-top: 20px;"></textarea>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>

<!-- 添加工序 -->
<div class="modal fade" id="addprocessshow">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">

            <!-- 模态框头部 -->
            <div class="modal-header">
                <h6 class="modal-title">您正在做的业务是：生产管理--产品生产工序设计--制定产品生产工序设计单</h6>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>

            <!-- 模态框主体 -->
            <div class="modal-body" style="background-color: white;height: 400px;">
                <div>
                    <button type="button" class="btn btn-secondary"style="margin-left: 700px;" data-dismiss="modal">返回</button>
                </div>

                <div style="display: flex;justify-content: center;margin-top: 16px;">
                    <h4 style="color: black">添加工序</h4>
                </div>
                <table class="table  table-hover table-bordered"  cellspacing="0" cellpadding="0"style="width: 720px;margin-left: 20px; text-align: center;margin-top: 20px;" >
                    <tr class="table-primary">
                        <td>工序编号</td>
                        <td>工序名称</td>
                        <td>工序描述</td>
                        <td>工序添加</td>
                    </tr>
                    <tbody>
                    <tr >
                        <td>01</td>
                        <td>组装</td>
                        <td>&nbsp;</td>
                        <td><a href="#" id="tjiazz">添加</a></td>
                    </tr>
                    <tr>
                        <td>02</td>
                        <td>测试</td>
                        <td>&nbsp;</td>
                        <td><a href="#" id="tjiacs">添加</a></td>
                    </tr>
                    <tr>
                        <td>03</td>
                        <td>包装</td>
                        <td>&nbsp;</td>
                        <td><a href="#" id="tjbz">添加</a></td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</div>

<script>

    //弹出框要写在 jQuery 的初始化代码里: 然后在指定的元素上调用 popover() 方法。以下实例可以在文档的任何地方使用弹出框：
    $(document).ready(function(){
        $('[data-toggle="popover"]').popover();
    });
    var i=true;
    var i1=true;
    var i2=true;
    $(function () {
        $("#tabb").bootstrapTable({
            method: "post",
            contentType: "application/x-www-form-urlencoded;charset=utf-8",
            url: "/lc/querypageall",
            striped: true,
            pageNumber: 1,
            pagination: true,
            sidePagination: "server",
            pageSize: 3,
            pageList: [3, 5, 8, 10],
            queryParams: function (parms) {
                return {
                    pageNum: (parms.offset / parms.limit) + 1,
                    pageSize: parms.limit,
                    register_time_start:$("#register_time_start").val(),
                    register_time_end:$("#register_time_end").val(),
                    product_name:$("#product_name").val()

                }
            },
            columns: [
                {title: "产品编号", field: "productId", align: "center",
                formatter:function (value,row,index) {
                    var a1="<a href='#' data-toggle=\"modal\" data-target=\"#showall\" onclick='allmessage("+JSON.stringify(row)+")'>"+value+"</a>"
                    return a1;
                }},
                {title: "产品名称", field: "productName", align: "center"},
                {title: "档次级别", field: "productClass", align: "center",
                    formatter:function (value,row,index) {
                    return value=='d001-1'?'高档':value=='d001-2'?'中档':'低档';
                    }},
                {title: "一级分类", field: "firstKindName", align: "center"},
                {title: "二级分类", field: "secondKindName", align: "center"},
                {title: "三级分类", field: "thirdKindName", align: "center"},
                {title: "产品经理", field: "responsiblePerson", align: "center"},
                {title: "编辑", field: "productId", align: "center",
                    formatter: function (value, row, index) {
                        //方式1
                        /*var btn1="<button  class='btn btn-primary btn-sm' data-toggle='modal' onclick='editEmp("+JSON.stringify(row)+")' data-target='#myModal'>修改</button>";*/
                        //方式2
                        var btn1 = "<button  class=\"btn btn-primary btn-sm\" data-toggle=\"modal\" onclick='zhidingsheji("+JSON.stringify(row)+")' data-target=\"#showsheet\">制定设计单</button>";
                        return btn1;
                    }
                },
            ],
        })
        $("#query_file_ok").click(function () {
            $("#tabb").bootstrapTable("refresh")
        })


        $("#all").click(function(){
            $("#zy").show();
            $("#fz").show()
        })
        $("#zyxx").click(function(){
            $("#zy").show();
            $("#fz").hide();
        })
        $("#fzxx").click(function(){
            $("#zy").hide();
            $("#fz").show();
        })

        //点击添加把组装添加到制定工序表页面中

        $("#tjiazz").click(function () {
            if(i==true){
                $("#shengcahngtab").append("<tr class='ztr'>" +
                    "<td><input  type='checkbox' class='chek' value='组装'></td>" +
                    "<td>组装</td>" +
                    "<td>01</td>" +
                    "<td></td>" +
                    "<td><input id='yl_text1' type='number' style='outline: none;border: none;width: 70px;' onblur='yulang1()'  title=\"请不要输入空的工时数\" data-toggle=\"popover\" data-trigger=\"hover\"></td>" +
                    "<td><input id='yl_text2'  type='text' style='outline: none;border: none;width: 50px;'></td>" +
                    "<td><input id='yl_text3'  type='number' style='outline: none;border: none;width: 70px;' onblur='yulang1()' title=\"请不要输入空的工时成本\" data-toggle=\"popover\" data-trigger=\"hover\"></td>" +
                    "<td class='cb' id='yl_text4'></td>" +
                    "</tr>")
                i=false;
            }
        })

        //点击添加把测试添加到制定工序表页面中
        $("#tjiacs").click(function () {
            if(i1==true){
                $("#shengcahngtab").append("<tr class='ztr'>" +
                    "<td><input  type='checkbox' class='chek' value='测试'></td>" +
                    "<td>测试</td>" +
                    "<td>02</td>" +
                    "<td></td>" +
                    "<td><input id='yl_text5' type='number' style='outline: none;border: none;width: 70px; ' onblur='yulang2()'  title=\"请不要输入空的工时数\" data-toggle=\"popover\" data-trigger=\"hover\"></td>" +
                    "<td><input id='yl_text6' type='text' style='outline: none;border: none;width: 50px; '></td>" +
                    "<td><input id='yl_text7'  type='number' style='outline: none;border: none;width: 70px; ' onblur='yulang2()'  title=\"请不要输入空的工时成本\" data-toggle=\"popover\" data-trigger=\"hover\"></td>" +
                    "<td class='cb' id='yl_text8'></td>" +
                    "</tr>")
                i1=false;
            }
        })

        //点击添加把测试添加到制定工序表页面中
        $("#tjbz").click(function () {
            if(i2==true){
                $("#shengcahngtab").append("<tr class='ztr'>" +
                    "<td><input  type='checkbox' class='chek' value='包装'></td>" +
                    "<td>包装</td>" +
                    "<td>03</td>" +
                    "<td></td>" +
                    "<td><input  id='yl_text9' type='number' style='outline: none;border: none;width: 70px;' onblur='yulang3()'  title=\"请不要输入空的工时数\" data-toggle=\"popover\" data-trigger=\"hover\"></td>" +
                    "<td><input  id='yl_text10' type='text' style='outline: none;border: none;width: 50px; '></td>" +
                    "<td><input  id='yl_text11' type='number' style='outline: none;border: none;width: 70px; ' onblur='yulang3()' title=\"请不要输入空的工时成本\" data-toggle=\"popover\" data-trigger=\"hover\"></td>" +
                    "<td class='cb'  id='yl_text12'></td>" +
                    "</tr>")
                i2=false;
            }
        })

        //删除工序：选中的删除
        $("#deletegx").click(function () {
            $(".chek").each(function () {
                if($(this).prop("checked")==true){
                    $(this).parent().parent().remove();
                    if($(this).val()=='组装'){
                        i=true
                    }

                    if($(this).val()=='测试'){
                        i1=true
                    }

                    if($(this).val()=='包装'){
                        i2=true
                    }
                }
            })
        })

        //提交制定
        $("#tijiao").click(function () {
            var cc=0;
            if($("#shengcahngtab tr").length==1){
                alert("请添加工序，然后再提交")
                cc+=1;
            }else  if($(".ztr input[type=number]").val()=="" || $(".ztr input[type=number]").val()==null || $(".ztr input[type=number]").val()==0){
                alert("工时数或工时成本不能为空或者为0")
                cc+=1;
            }

            if($("#she_designer").val()=="" ||$("#she_designer").val==null){
               alert("设计人不能为空")
                cc+=1;
            }




            if(cc==0){
                var xgxobj={};
                var dgxobj=[];
                //工时总成本+=工时小计
                costsum=0;
                $(".ztr").each(function () {
                    costsum+=parseFloat($(this).find(" td:eq(7)").text());
                    xgxobj={
                        procedureId:$(this).find(" td:eq(2)").text(),
                        procedureName:$(this).find(" td:eq(1)").text(),
                        labourHourAmount:parseInt($(this).find(" td:eq(4)>input").val()),
                        amountUnit:$(this).find(" td:eq(5)>input").val(),
                        costPrice:parseInt($(this).find(" td:eq(6)>input").val()),
                        subtotal:$(this).find(" td:eq(7)").text(),
                        register:$("#she_checker").val(),
                        registerTime:$("#she_checkTime").text()
                    }
                    dgxobj.push(xgxobj)
                })
                var gongxu={
                    productId:$("#she_productId").text(),
                    productName:$("#she_product_name").text(),
                    procedureDescribe:$("#she_procedureDescribe").val(),
                    costPriceSum:costsum,
                    designer:$("#she_designer").val(),
                    register:$("#she_checker").val(),
                    registerTime:$("#she_checkTime").text()
                }
                var gongxujson = JSON.stringify(gongxu)
                var dgxobjjson=JSON.stringify(dgxobj);
                console.log(gongxujson);
                console.log(dgxobjjson);

                // JSON.stringify({mDesignProcedureDetailslist:dgxobj,mDesignProcedure:gongxu})
                $.ajax({
                    type:"POST",
                    contentType: 'application/json',
                    url:"/lc/zhidingshejidan",
                    data:
                        JSON.stringify({mdesignProcedure:gongxu,
                            mdesignProcedureDetailslist:dgxobj}),
                    success:function (dataok) {
                        if(dataok==1){
                            alert("制定设计单完成")
                            $("#showsheet").modal("hide")
                            $("#tabb").bootstrapTable("refresh")
                        }
                    }

                })
            }


        })

    })

    //点击编号跳出一个模态框显示该产品编号对应的全部信息和主要信息，辅助信息。
    function allmessage(data) {
        //产品编号
        $("#q_productId").val(data.productId)
        //    产品名称
        $("#q_productName").val(data.productName);
        //制造商
        $("#q_factoryName").val(data.factoryName);
        //    产品i级分类名称
        $("#q_firstKindName").val(data.firstKindName);
        //    产品ii级分类名称
        $("#q_secondKindName").val(data.secondKindName);
        //    产品iii级分类名称
        $("#q_thirdKindName").val(data.thirdKindName);
        //产品简称
        $("#q_productNick").valueOf(data.productNick)
        //用途类型
        $("#q_type").val(data.type=='y001-1'?'商品':'物料');
        //档次级别
        //d001-1: 高档
        //d001-2: 中档
        //d001-3: 低档
        $("#q_productClass").val(data.productClass=='d001-1'?'高档':data.productClass=='d001-2'?'中档':'低档');
        //计量单位
        $("#q_personalUnit").val(data.personalUnit);
        //    计量值
        $("#q_personalValue").val(data.personalValue);
        //市场单价
        $("#q_listPrice").val(data.listPrice);
        ////    计划成本单价
        $("#q_costPrice").val(data.costPrice);
        //成本单价
        $("#q_realCostPrice").val(data.realCostPrice);
        //保修期
        $("#q_warranty").val();
        //替代品名称
        $("#q_twinName").val(data.twinName);
        //替代品编号
        $("#q_twinId").val(data.twinId);
        //生命周期
        $("#q_lifecycle").val(data.lifecycle);
        //单位
        $("#q_amountUnit").val(data.amountUnit);
        //供应商集合
        $("#q_providerGroup").val(data.providerGroup);
        //产品描述
        $("#q_productDescribe").val(data.productDescribe);
        //档案变更累计
        $("#q_fileChangeAmount").val(data.fileChangeAmount);
        //变更时间
        $("#q_changeTime").val(data.changeTime==null?"没有变更时间;":data.changeTime);
        //建档时间
        $("#q_registerTime").val(data.registerTime);
        //产品经理
        $("#q_responsiblePerson").val(data.responsiblePerson);
        //登记人
        $("#q_register").val(data.register);
        //    复核人
        $("#q_checker").val(data.checker);
        //复核时间
        $("#q_checkTime").val(data.checkTime);
    }
    //预览：
    function  yulang1() {
        var a=0;
        if($("#yl_text1").val()!=null && $("#yl_text1").val()!=''){
            a=parseFloat($("#yl_text1").val())
        }else{
            a=0;
        }
        var b=0;
        if($("#yl_text3").val()!=null && $("#yl_text3").val()!=''){
        var b=parseFloat($("#yl_text3").val())
        }else{
            b=0;
        }
        var c=a*b;
      $("#yl_text4").html(c)
    }
    //预览：
    function  yulang2() {
        var a=0;
        if($("#yl_text5").val()!=null && $("#yl_text5").val()!=''){
            a=parseFloat($("#yl_text5").val())
        }else{
            a=0;
        }
        var b=0;
        if($("#yl_text7").val()!=null && $("#yl_text7").val()!=''){
            var b=parseFloat($("#yl_text7").val())
        }else{
            b=0;
        }
        var c=a*b;
        $("#yl_text8").html(c)
    }
    //预览：
    function  yulang3() {
        var a=0;
        if($("#yl_text9").val()!=null && $("#yl_text9").val()!=''){
            a=parseFloat($("#yl_text9").val())
        }else{
            a=0;
        }
        var b=0;
        if($("#yl_text11").val()!=null && $("#yl_text11").val()!=''){
            var b=parseFloat($("#yl_text11").val())
        }else{
            b=0;
        }
        var c=a*b;
        $("#yl_text12").html(c)
    }

    //制定设计单
    function zhidingsheji(zhidata) {
        $("#she_product_name").html(zhidata.productName)
        $("#she_productId").html(zhidata.productId)
        $("#shengcahngtab tr:not(:eq(0))").remove();
        i = true;
        i1 = true;
        i2 = true;
        $("#she_checker").val(zhidata.checker)
        var myDate = new Date;
       $("#she_checkTime").html(myDate.toLocaleString());
       $("#she_designer").val("");
       $("#she_procedureDescribe").val("");
       $.ajax({
           type:"post",
           url:"/SysUser/queryUser",
           success:function (lodata) {
               $("#she_checker").val(lodata.loginId)
           }
       })
    }

</script>
</body>
</html>